//////////////////////////////////////////////////////////
// This class has been automatically generated on
// Sat Jan 17 11:25:08 2015 by ROOT version 5.34/14
// from TTree default/7
// found on file: AnaOut_allA0.root
//////////////////////////////////////////////////////////

#ifndef AnaTask1_h
#define AnaTask1_h

#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>

// Header file for the classes stored in the TTree if any.

// Fixed size dimensions of array or collections stored in the TTree if any.

#define _KOLDCODE_PREPROCESS 0

class AnaTask1 {
public :
   TTree          *fChain;   //!pointer to the analyzed TTree or TChain
   Int_t           fCurrent; //!current Tree number in a TChain

   // Declaration of leaf types ->

   //accum_level is different in CCQE and CCPX
#if _KOLDCODE_PREPROCESS   
   Int_t           accum_level[1][4];   //[NTOYS]
#else
   Int_t           accum_level[1];   //[NTOYS]
#endif

   Int_t           nu_truereac;
   Int_t topology;
   Int_t           nu_parentpdg;
   Int_t           nu_pdg;

   Int_t           ntrackertracks;
   Int_t           ntpctracks;
   Float_t         vertex_pos[4];

   Float_t         selmu_dir[3];
   Float_t         selmu_mom[1];   //[NTOYS]
   Float_t         selmu_endpos[4];
   Int_t           selmu_NDOF[1];   //[NTOYS]
   Float_t         selmu_Chi2[1];   //[NTOYS]
   Int_t           selmu_ntpcs;
   Int_t           selmu_tpc_nhits[2];   //[selmu_ntpcs]

   Float_t         selp_dir[3];
   Float_t         selp_mom[1];   //[NTOYS]
   Float_t         selp_endpos[4];
   Int_t           selp_NDOF[1];   //[NTOYS]
   Float_t         selp_Chi2[1];   //[NTOYS]
   Int_t           selp_ntpcs;
   Int_t           selp_tpc_nhits[2];   //[selp_ntpcs]
   Float_t         selp_truedir[4];
   Float_t         selp_truemom;
   Int_t           selp_pdg;

   Float_t         selX_dir[3];
   Float_t         selX_mom[1];   //[NTOYS]
   Float_t         selX_endpos[4];
   Int_t           selX_NDOF[1];   //[NTOYS]
   Float_t         selX_Chi2[1];   //[NTOYS]
   Int_t           selX_ntpcs;
   Int_t           selX_tpc_nhits[2];   //[selX_ntpcs]
   Float_t         selX_truedir[4];
   Float_t         selX_truemom;
   Int_t           selX_pdg;
   Int_t           selX_charge;
   Int_t           selX_PID;

   Float_t         nu_truedir[3];
   Float_t         nu_trueE;

   Float_t         truemu_truemom;
   Float_t         truemu_truedir[3];
   Int_t           selmu_pdg;

   Int_t           eventtypesim;
   Int_t           simotherpdg;
   Int_t           necaltracks;
   Int_t           ecalpdgsim;

   // List of branches ->
   //$ cat tmp  | tr -s ';[' ' ' | awk '{printf("TBranch        *b_%s;\n", $2)}' | grep -v "_;"
TBranch        *b_accum_level;
TBranch        *b_nu_truereac;
TBranch        *b_topology;
TBranch        *b_nu_parentpdg;
TBranch        *b_nu_pdg;
TBranch        *b_ntrackertracks;
TBranch        *b_ntpctracks;
TBranch        *b_vertex_pos;
TBranch        *b_selmu_dir;
TBranch        *b_selmu_mom;
TBranch        *b_selmu_endpos;
TBranch        *b_selmu_NDOF;
TBranch        *b_selmu_Chi2;
TBranch        *b_selmu_ntpcs;
TBranch        *b_selmu_tpc_nhits;
TBranch        *b_selp_dir;
TBranch        *b_selp_mom;
TBranch        *b_selp_endpos;
TBranch        *b_selp_NDOF;
TBranch        *b_selp_Chi2;
TBranch        *b_selp_ntpcs;
TBranch        *b_selp_tpc_nhits;
TBranch        *b_selp_truedir;
TBranch        *b_selp_truemom;
TBranch        *b_selp_pdg;
TBranch        *b_selX_dir;
TBranch        *b_selX_mom;
TBranch        *b_selX_endpos;
TBranch        *b_selX_NDOF;
TBranch        *b_selX_Chi2;
TBranch        *b_selX_ntpcs;
TBranch        *b_selX_tpc_nhits;
TBranch        *b_selX_truedir;
TBranch        *b_selX_truemom;
TBranch        *b_selX_pdg;
TBranch        *b_selX_charge;
TBranch        *b_selX_PID;
TBranch        *b_nu_truedir;
TBranch        *b_nu_trueE;
TBranch        *b_truemu_truemom;
TBranch        *b_truemu_truedir;
TBranch        *b_selmu_pdg;
TBranch        *b_eventtypesim;   
TBranch        *b_simotherpdg;   
TBranch        *b_necaltracks;   
TBranch        *b_ecalpdgsim;   

   AnaTask1():fChain(0) {}//hand-made
   virtual ~AnaTask1();
   virtual void     Init(TTree *tree);

   virtual void     DoAnalysis(const TString filelist, const Int_t ntarget, const TString tag, const Int_t krec); //hand-made
};

#endif

#ifdef AnaTask1_cxx

AnaTask1::~AnaTask1()
{
   if (!fChain) return;
   delete fChain->GetCurrentFile();
}

void AnaTask1::Init(TTree *tree)
{
   // The Init() function is called when the selector needs to initialize
   // a new tree or chain. Typically here the branch addresses and branch
   // pointers of the tree will be set.
   // It is normally not necessary to make changes to the generated
   // code, but the routine can be extended by the user if needed.
   // Init() will be called many times when running on PROOF
   // (once per file to be processed).

   // Set branch addresses and branch pointers
   if (!tree) return;
   fChain = tree;
   fCurrent = -1;
   fChain->SetMakeClass(1);

   // Set branch addresses and branch pointers    ->
   //$ cat tmp  | tr -s ';[' ' ' |  awk '{printf("fChain->SetBranchAddress(\"%s\", &%s,&b_%s);\n", $2,$2,$2)}' | grep -v "\"\""
fChain->SetBranchAddress("accum_level", &accum_level,&b_accum_level);
fChain->SetBranchAddress("nu_truereac", &nu_truereac,&b_nu_truereac);
fChain->SetBranchAddress("topology", &topology,&b_topology);
fChain->SetBranchAddress("nu_parentpdg", &nu_parentpdg,&b_nu_parentpdg);
fChain->SetBranchAddress("nu_pdg", &nu_pdg,&b_nu_pdg);
fChain->SetBranchAddress("ntrackertracks", &ntrackertracks,&b_ntrackertracks);
fChain->SetBranchAddress("ntpctracks", &ntpctracks,&b_ntpctracks);
fChain->SetBranchAddress("vertex_pos", &vertex_pos,&b_vertex_pos);
fChain->SetBranchAddress("selmu_dir", &selmu_dir,&b_selmu_dir);
fChain->SetBranchAddress("selmu_mom", &selmu_mom,&b_selmu_mom);
fChain->SetBranchAddress("selmu_endpos", &selmu_endpos,&b_selmu_endpos);
fChain->SetBranchAddress("selmu_NDOF", &selmu_NDOF,&b_selmu_NDOF);
fChain->SetBranchAddress("selmu_Chi2", &selmu_Chi2,&b_selmu_Chi2);
fChain->SetBranchAddress("selmu_ntpcs", &selmu_ntpcs,&b_selmu_ntpcs);
fChain->SetBranchAddress("selmu_tpc_nhits", &selmu_tpc_nhits,&b_selmu_tpc_nhits);
fChain->SetBranchAddress("selp_dir", &selp_dir,&b_selp_dir);
fChain->SetBranchAddress("selp_mom", &selp_mom,&b_selp_mom);
fChain->SetBranchAddress("selp_endpos", &selp_endpos,&b_selp_endpos);
fChain->SetBranchAddress("selp_NDOF", &selp_NDOF,&b_selp_NDOF);
fChain->SetBranchAddress("selp_Chi2", &selp_Chi2,&b_selp_Chi2);
fChain->SetBranchAddress("selp_ntpcs", &selp_ntpcs,&b_selp_ntpcs);
fChain->SetBranchAddress("selp_tpc_nhits", &selp_tpc_nhits,&b_selp_tpc_nhits);
fChain->SetBranchAddress("selp_truedir", &selp_truedir,&b_selp_truedir);
fChain->SetBranchAddress("selp_truemom", &selp_truemom,&b_selp_truemom);
fChain->SetBranchAddress("selp_pdg", &selp_pdg,&b_selp_pdg);

fChain->SetBranchAddress("selX_dir", &selX_dir,&b_selX_dir);
fChain->SetBranchAddress("selX_mom", &selX_mom,&b_selX_mom);
fChain->SetBranchAddress("selX_endpos", &selX_endpos,&b_selX_endpos);
fChain->SetBranchAddress("selX_NDOF", &selX_NDOF,&b_selX_NDOF);
fChain->SetBranchAddress("selX_Chi2", &selX_Chi2,&b_selX_Chi2);
fChain->SetBranchAddress("selX_ntpcs", &selX_ntpcs,&b_selX_ntpcs);
fChain->SetBranchAddress("selX_tpc_nhits", &selX_tpc_nhits,&b_selX_tpc_nhits);
fChain->SetBranchAddress("selX_truedir", &selX_truedir,&b_selX_truedir);
fChain->SetBranchAddress("selX_truemom", &selX_truemom,&b_selX_truemom);
fChain->SetBranchAddress("selX_pdg", &selX_pdg,&b_selX_pdg);
fChain->SetBranchAddress("selX_charge", &selX_charge,&b_selX_charge);
fChain->SetBranchAddress("selX_PID", &selX_PID,&b_selX_PID);
fChain->SetBranchAddress("eventtypesim", &eventtypesim, &b_eventtypesim);
fChain->SetBranchAddress("simotherpdg", &simotherpdg, &b_simotherpdg);
fChain->SetBranchAddress("necaltracks", &necaltracks, &b_necaltracks);
fChain->SetBranchAddress("ecalpdgsim", &ecalpdgsim, &b_ecalpdgsim);
fChain->SetBranchAddress("nu_truedir", &nu_truedir,&b_nu_truedir);
fChain->SetBranchAddress("nu_trueE", &nu_trueE,&b_nu_trueE);
fChain->SetBranchAddress("truemu_truemom", &truemu_truemom,&b_truemu_truemom);
fChain->SetBranchAddress("truemu_truedir", &truemu_truedir,&b_truemu_truedir);

#if _KOLDCODE_PREPROCESS
fChain->SetBranchAddress("particle", &selmu_pdg,&b_selmu_pdg);
#else
fChain->SetBranchAddress("selmu_pdg", &selmu_pdg,&b_selmu_pdg);
#endif

}

#endif // #ifdef AnaTask1_cxx
